package com.spa.infrastructure.mapper;

import com.spa.domain.entity.OrderAddress;
import com.spa.infrastructure.repository.po.OrderAddressPO;
import com.spa.infrastructure.repository.po.OrderDetailPO;
import org.mapstruct.Mapper;
import org.mapstruct.MapperConfig;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
@MapperConfig(unmappedTargetPolicy = ReportingPolicy.WARN)
public interface OrderClientMapperStruct {

    OrderClientMapperStruct INSTANCE = Mappers.getMapper(OrderClientMapperStruct.class);

    OrderAddress po2Entity(OrderAddressPO po);

    @Mapping(source = "addressName", target = "name")
    @Mapping(source = "addressPhone", target = "phone")
    @Mapping(source = "addressRegion", target = "region")
    @Mapping(source = "addressAddress", target = "address")
    @Mapping(source = "addressLon", target = "lon")
    @Mapping(source = "addressLat", target = "lat")
    OrderAddress po2Entity(OrderDetailPO po);

    List<OrderAddress> po2Entity4List(List<OrderAddressPO> po);

}
